export const getLogisticsStatusName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 0:
        return '待发货' as const
      case 1:
        return '报关中' as const
      case 2:
        return '运输中' as const
      case 3:
        return '清关中' as const
      case 4:
        return '中转中' as const
      case 5:
        return '派送中' as const
      case 6:
        return '已签收' as const
      case 7:
        return '已归档' as const
      case 8:
        return '异常' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  {
    /** 运单列表 */
    valueList: [0, 1, 2, 3, 4, 5, 6, 7, 8],
    /** 非运单列表 */
    valueList2: [0, 1, 2, 3, 4, 5, 6],
  },
)

export const getRouteNodeName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 0:
        return '国内仓' as const
      case 1:
        return '起运港拖车' as const
      case 2:
        return '起运港' as const
      case 3:
        return '干线运输' as const
      case 4:
        return '目的港' as const
      case 5:
        return '目的港拖车' as const
      case 6:
        return '海外仓' as const
      case 7:
        return '尾程派送' as const
      case 8:
        return '目的地' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [0, 1, 2, 3, 4, 5, 6, 7, 8] },
)

export const getFirstLineName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 1:
        return '海运' as const
      case 2:
        return '空运' as const
      case 3:
        return '卡航' as const
      case 4:
        return '铁路' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [1, 2, 3, 4] },
)

export const getTailLineName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 1:
        return '快递' as const
      case 2:
        return '卡车' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [1, 2] },
)

export const getErrorrTypeName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 0:
        return '监管异常' as const
      case 1:
        return '承运商异常' as const
      case 2:
        return '不可抗力异常' as const
      case 3:
        return '收件人异常' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [0, 1, 2, 3] },
)

export const getIconTypeName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 1:
        return '超时未更新' as const
      case 2:
        return '新原始路由' as const
      case 3:
        return '异常' as const
      case 4:
        return '待发送邮件' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  {
    valueList: [1, 2, 3, 4],
    tmsValueList: [1, 2, 3],
    omsValueList: [3, 4],
  },
)

export const getRouteTypeName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 1:
        return '正常' as const
      case 2:
        return '异常' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [1, 2] },
)

export const getReadStatusName = (value: number | null | undefined) => {
  switch (value) {
    case 0:
      return '未读' as const
    case 1:
      return '已读' as const
    default:
      return `${value ?? ''}` || null
  }
}

export const getBooleanName = (value: number | boolean | null | undefined) => {
  switch (value) {
    case 0:
    case false:
      return '否' as const
    case 1:
    case true:
      return '是' as const
    default:
      return null
  }
}

export const getShipFromName = Object.assign(
  (value: number | null | undefined, isEn?: boolean) => {
    switch (value) {
      case 1:
        return isEn ? 'International' : ('国际' as const)
      case 2:
        return isEn ? 'Local' : ('本土' as const)
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [1, 2] },
)

export const getStaffTypeName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 1:
        return '业务员' as const
      case 2:
        return '岗后跟单员' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [1, 2] },
)

export const getPublishStatusName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 0:
        return '待发布' as const
      case 1:
        return '已发布' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [0, 1] },
)

export const getFileTypeName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 1:
        return '装箱单'
      case 2:
        return '报关文件'
      case 3:
        return '清关文件'
      case 4:
        return '标签文件'
      case 5:
        return '签收文件(POD)'
      case 6:
        return '其他文件'
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [1, 2, 3, 4, 5, 6] },
)

export const getSourceTypeName = Object.assign(
  (value: number | null | undefined) => {
    switch (value) {
      case 1:
        return 'OMS' as const
      case 2:
        return 'TMS' as const
      case 3:
        return '其它' as const
      default:
        return `${value ?? ''}` || null
    }
  },
  { valueList: [1, 2, 3] },
)
